Electronic apparatus and control method thereof

ABSTRACT

An electronic apparatus and a control method of the electronic apparatus is provided. The method includes acquiring source code written in a programing language, identifying a structure including a function pointer from the source code, identifying a plurality of initialized variables as a plurality first variables among variables of the function pointer included in the identified structure, and modifying the source code by changing an indirect call using an unmodifiable variable among the plurality of first variables to a direct call.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based on and claims priority under 35 U.S.C. §119(a) of a Korean patent application number 10-2020-0009517, filed onJan. 23, 2020 in the Korean Intellectual Property Office, the disclosureof which is incorporated by reference herein in its entirety.

BACKGROUND 1. Field

The disclosure relates to an electronic apparatus and a control methodthereof. More particularly, the disclosure relates to an electronicapparatus for changing an indirect call of a structure including anunchanged variable included in source code into a direct call, and acontrol method thereof.

2. Description of the Related Art

The development of computer technology has changed the lives of modernpeople.

However, attempts to exploit this to gain unfair advantage have beenincreasing. For example, control flow attacks using indirect callsincluded in source code using memory corruption such as Use-After-Freeare increasing. The Use-After-Free refers to free an allocated memoryand then accesses the memory. When using the freed memory, corruption ofstored data or arbitrary code may be executed.

Conventionally, a devirtualization technique for replacing an indirectcall with respect to a virtual method without overriding the source codewritten in an object oriented programming language to a direct call inorder to protect against the attack described above. However, theconventional devirtualization technique may be applied only to thesource code using the object oriented programming language, and may beapplied only when the annotation is included in the source code.

Accordingly, there is a need to protect source codes written in alanguage other than an object oriented programming language in variouslayers such as kernel, application, and remote procedure call (RPC), orthe like.

SUMMARY

An aspect of the disclosure is to provide a control method of anelectronic apparatus. The method includes acquiring source code writtenin a programing language, identifying a structure including a functionpointer from the source code, identifying a plurality of initializedvariables as a plurality first variables among variables of the functionpointer included in the identified structure and modifying the sourcecode by changing an indirect call using an unmodifiable variable amongthe plurality of first variables to a direct call.

Another aspect of the disclosure is to provide an electronic apparatus.The electronic apparatus includes a memory configured to store at leastone instruction, and a processor, wherein the processor is configured toacquire source code written in a programming language by executing theinstruction, identify a structure including a function pointer from thesource code, identify a plurality of initialized variables as aplurality first variables among variables of the function pointerincluded in the identified structure, and modify the source code bychanging an indirect call using an unmodifiable variable among theplurality of first variables to a direct call.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other aspects, features, and advantages of certainembodiments of the disclosure will be more apparent from the followingdescription taken in conjunction with the accompanying drawings, inwhich:

FIG. 1 is a view illustrating a method for changing an indirect call toa direct call according to an embodiment of the disclosure;

FIG. 2 is a block diagram illustrating a structure of an electronicapparatus, according to an embodiment of the disclosure;

FIG. 3 is a view illustrating an implementation example according to anembodiment of the disclosure;

FIG. 4 is a view illustrating an implementation example according to anembodiment of the disclosure;

FIG. 5 is a view illustrating a design pattern according to anembodiment of the disclosure;

FIG. 6A is a view illustrating source code in a form of c languageaccording to an embodiment of the disclosure;

FIG. 6B is a view illustrating source code of FIG. 6A converted into anintermediate language form according to an embodiment of the disclosure;

FIG. 6C is a view illustrating an indirect call is converted into adirect call in a code of an intermediate language form according to anembodiment of the disclosure; and

FIG. 7 is a flowchart for changing an indirect call included in sourcecode into a direct call according to an embodiment of the disclosure.

DETAILED DESCRIPTION

The following description with reference to the accompanying drawings isprovided to provide an electronic apparatus that changes an indirectcall using an unchanged variable in a structure of source code to adirect call and a control method hereof.

The disclosure will be described in detail with reference to theaccompanying drawings.

FIG. 1 is a view illustrating a method for changing an indirect call toa direct call according to an embodiment of the disclosure.

Referring to FIG. 1, source code is source code written in a programminglanguage, and a part of the source code is briefly illustrated inFIG. 1. the electronic apparatus according to the disclosure may acquiresource code written in a programming language, and identify a structureincluding a function pointer in the acquired source code (S110).

The source code according to the disclosure may not include annotationor may be source code not written in an object oriented programminglanguage, and details thereof will be described below with reference toFIG. 2.

Referring to FIG. 1, the source code illustrates a struct A including afunction pointer. The function pointer is a type of pointers supportedby programming languages, and refers to an executable code, instead ofreferring to data values, in memory. When the function pointer isdereferenced, a function pointed by the function pointer may be operatedas a normal function call. An indirect call is defined to make thefunction indicated by the function pointer operate like a normalfunction call.

When the electronic apparatus identifies a structure including afunction pointer in the source code, the function pointer may identify avariable initialized with a specific function as a first variable amongvariables for the function pointer included in the correspondingstructure in the identified structure (S120). In other words, referringto FIG. 1, the electronic apparatus may identify a target1 variableincluding a portion where the function pointer is initialized to func1and a target 2 variable including a portion where the function pointeris initialized to func2 as the first variable from the struct A.

The electronic apparatus may identify a variable that may be modifiedamong the first variables as a second variable (S130). The variable thatmay be modified may include at least one of variables that arereassigned to other variables or delivered as changeable parameters.Referring to FIG. 1, when the target2 variable is reassigned to atarget3 variable, the target2 variable reassigned to the target3variable may be identified as the second variable. In addition, when thetarget2 variable is transferred to the changeable parameter through themodify_func (target2, a, b, ..) included in the source code of FIG. 1,the target2 variable transferred to the changeable parameter may beidentified as the second variable. In addition, the electronic apparatusmay identify a variable other than the second variable among the firstvariables as a third variable, and modify the source code by changing anindirect call using the third variable to a direct call. (S140). Inother words, referring to the source code of FIG. 1, the functionpointer of the target1 variable is initialized to func1, and is notreassigned or transferred to the changeable parameter. Accordingly, theelectronic apparatus may identify the target1 variable as the thirdvariable, and change the indirect call using the target1 variable to thedirect call.

According to an embodiment, the process described above may beimplemented in a plugin of a compiler for compiling source code, anddetails will be described below with reference to FIGS. 6A and 6B.

Through the process described above, the indirect call included in astructure type including an unchanged variable in the source code, evenfor source code that does not include annotation or is not written inthe object oriented programming language may be changed to the directcall to protect the indirect call of the source code.

According to various embodiments of the disclosure, the electronicapparatus may change the indirect call using the unchanged variableincluded in the source code written in the programming language to thedirect call such that a control flow attack on the source code may beprevented.

FIG. 2 is a block diagram illustrating a structure of an electronicapparatus, according to an embodiment of the disclosure.

Referring to FIG. 2, the electronic apparatus 100 may include a memory110 and a processor 120.

Various types of data such as programs, files, or the like such asapplications may be installed and stored in the memory 110. Theprocessor 120 may access and use data stored in the memory 110, or maystore new data in the memory 110. The processor 120 may execute aprogram installed in the memory 110. In addition, the processor 120 mayinstall an application received from the outside in the memory 110.

The memory 110, for example, may store an instruction or data regardingat least one of the other elements of the electronic apparatus 100. Thememory 110 may be implemented as a non-volatile memory, a volatilememory, a flash memory, a hard disk drive (HDD), a solid state drive(SDD), or the like. The memory 110 may be accessed by the processor 120,and perform readout, recording, correction, deletion, update, and thelike, on data by the processor 120. According to an embodiment of thedisclosure, the term of the memory may include the memory 110, read-onlymemory (ROM) (not illustrated) and random access memory (RAM) (notillustrated) within the processor 140, and a memory card (notillustrated) attached to the electronic apparatus 100 (e.g., microsecure digital (SD) card or memory stick).

The processor 120 may be electrically connected to the memory 110 tocontrol an overall operation and function of the electronic apparatus100. The processor 120 may change an indirect call included in thesource code into a direct call by executing at least one instructionstored in the memory 110.

According to an embodiment, the processor 120 may be implemented as adigital signal processor (DSP), a microprocessor, a time controller(TCON), but is not limited thereto, and the processor may include one ormore among a central processing unit (CPU), micro controller unit (MCU),micro processing unit (MPU), controller, application processor (AP), orcommunication processor (CP), ARM processor, or may be defined as thecorresponding term. In addition, the processor 120 may be implemented asa system on chip (SoC), a large scale integration (LSI) with an embeddedprocessing algorithm, or field programmable gate array (FPGA).

For example, the processor 120 may acquire source code written in aprogramming language. In one embodiment of the disclosure, theelectronic apparatus 100 may receive source code from an external deviceor server. Alternatively, the electronic apparatus 100 may acquiresource code from a user.

In one embodiment of the disclosure, the processor 120 may acquiresource code written in an object oriented programming language, such asa C++ language, or the like, or source code written in a language otherthan the object oriented programming language. The object oriented meansthat data is treated as an object, and the C++ language may be theexample. In other words, according to the disclosure, the processor 120may change not only source code written in the object oriented languagebut also the indirect call included in source code written in a languageother than the object oriented language to a direct call.

The processor 120 may acquire source code that does not includeannotation.

Annotation is a kind of meta-data that can be used in addition to thesource code, and an annotation may be included in the source code toeasily perform data validation. In other words, the techniques forchanging an indirect call included in the existing source code to adirect call are limited to the source code written in the objectoriented language, or applicable only to the source code including theannotation. However, according to the disclosure, the processor 120 maychange an indirect call included in the source code written in alanguage other than the object oriented language and the source code notincluding an annotation into a direct call. However, it is not limitedthereto, and the indirect call included in the source code written inthe object oriented language or the source code including the annotationmay also be changed to a direct call according to the disclosure.

The processor 120 may identify a structure including a function pointerin the obtained source code. Function pointers are a type of pointerssupported by programming languages and refer to executable code inmemory instead of referring to data values. When a function pointer isdereferenced, the function indicated by the function pointer may behavelike a normal function call.

In other words, according to an embodiment of the disclosure, if it iswritten in the source code as below,

struct A target1 = { .fptr = func1, }; struct A target2 = { .fptr =func2, };the function pointer of the target1 variable of the structure A isinitialized to func1, the function pointer of the target2 variable isinitialized to func2, and the processor 120 may identify the target1variable and the target2 variable as the first variable.

The processor 120 may modify the source code by changing an indirectcall using an unchanged variable among the first variables to a directcall. For example, the processor 120 may identify a second variable thatcan be modified among the first variables. A variable that can bemodified means a variable that is reassigned to another variable or istransferred to a changeable parameter. For example, if target2=target3;is written in the source code, it means that the target2 variable, whichis the first variable, is reassigned to the target3 variable, and theprocessor 120 may identify the target2 variable, which is reassigned tothe target3 variable, as the second variable. Also, if modify_func(target2, a, b, ..) is written in the source code, it means that thetarget2 variable, which is the first variable, is transferred to achangeable parameter, and the processor 120 may identify the target2variable transferred to the changeable parameter as the second variable.

The processor 120 may identify the variable excluding the secondvariable among the first variables as a third variable, and modify thesource code by changing the indirect call using the third variable to adirect call. Specifically, the processor 120 may change the indirectcall using the third variable except for the second variable that isreassigned or transferred to a changeable parameter among the firstvariables initialized in the structure of the source code, and modifythe source code. As one embodiment, the third variable may be a consttype that is not changeable.

In other words, an object of the disclosure is to change the indirectcall using an unchanged variable into the direct call, and to preventcontrol flow attack using the indirect call included in the source code.The second variable may be modified later, so that only the indirectcall using a variable other than the second variable among the firstvariables may be changed to a direct call.

The processor 120 may change the modified source code to a machinelanguage. In other words, the process of changing the indirect callincluded in the source code according to the disclosure to the directcall is implemented in the form of a plug-in of the compiler or in theform of a plug-in of the linker in the phase of the compilation of thesource code. In other words, the processor 120 may modify the sourcecode in the form of a plug-in in the compiler for the compilationoperation, or may modify the source code in the form of a plug-in in thelinker for the compilation operation. However, it is not limitedthereto, and the process described above may be implemented in thecompiler or the linker itself.

FIG. 3 is a view illustrating an implementation example according to anembodiment of the disclosure.

The process of changing the indirect call using the third variableincluded in the source code to the direct call may be implemented ascompilers 321 and 322 in the process of compiling or as a linker (330)in itself, or may be implemented in the form of plug-ins 321-1 and 322-1of compilers 321 and 322 or plug-in 330-1 of linker 330.

The compile operation is a process of changing the source code writtenin a programming language into a file composed of a machine languagethat can be understood by a computer, and a compile operation may beperformed by the linker that combines a complier that changes the sourcecode to an object file and a plurality of object files to change it toone executable file.

Specifically, the compiler may translate one or more source codes 311and 312 into object files that can be understood by a computer. Forexample, as many object files as the number of source codes may begenerated. Although two source codes 311 and 312 are illustrated in FIG.3, the invention is not limited thereto, and three or more source codesmay be compiled. The object file may include functions required by theexecutable file.

The linker may generate one executable file 340 by linking one or moreobject files. The object file may include functions required forexecution of the executable file, and the linker may generate anexecutable file by linking the object files required for the executablefile.

According to an embodiment of the disclosure, an indirect call using anunchanged variable included in the source codes 311 and 312 may bechanged to a direct call in the phase of compile operation, this processmay be implemented in the compilers 321 and 322 for processing thecompile operation, or linker 330 in itself, or may be implemented in theform of the plug-ins 321-1, 322-1 of the compilers 321, 322 or plug-ins330 of the linker 330-1.

FIG. 4 is a view illustrating an implementation example according to anembodiment of the disclosure.

Specifically, FIG. 4 illustrates a process in which an indirect callusing a third variable included in the source code is changed to adirect call is implemented as a form of compilers 421 and 422 in thecompile operation or plug-in of the linker 430.

In other words, according to an embodiment of the disclosure, thecompiler plug-in according to the disclosure is applied to theintermediate code 421-1 of the compiler 421, and the indirect call usingthe third variable included in the source code may be modified to thedirect call.

According to an embodiment of the disclosure, the compiler plug-inaccording to the disclosure is applied to the link time optimizer of thelinker 430, and the indirect call using the third variable included inthe source code may be modified to the direct call.

FIG. 4 illustrates that the compiler plug-in is applied to both of theintermediate code 421-1 and the linker 430, but is not limited thereto,and is applied to one of the intermediate code 421-1 and the linker 430,and thus the indirect call using the third variable included in thesource code according to the disclosure may be modified to the directcall.

FIG. 5 is a view illustrating a design pattern according to anembodiment of the disclosure.

The indirect call is the basic part of a design pattern used whenimplementing a remote procedure call (RPC). The RPC means executing aremote function on a client. For example, the RPC is an interprocesscommunication technology that enables functions or procedures to beexecuted in different address spaces without coding for separate remotecontrol.

The design pattern refers to a pattern in which design templates arefrequently created for each type by standardizing frequently used designforms. Specifically, the design pattern is not used immediately byconverting it into program code like an algorithm, but it provides a wayto solve structural problems, and verifies the design knowledge acquiredby many developers through their experience, and it is a generalizedtemplate that the verified knowledge is abstracted.

Referring to FIG. 5, in a smartphone application, a remote procedurecall (RPC) may be used to execute a function in a network or IoT devicein a remote location. In other words, when source code written in aprogramming language using the RPC is compiled into an executableprogram, the electronic apparatus according to the disclosure may modifythe indirect call of the source code written in a programming languageto the direct call.

In other words, there are many cases that a target function of thedirect call in the RPC is not modified. The electronic apparatusaccording to the disclosure may modify the indirect call using avariable including a corresponding target function with respect to acase when the target function is not modified.

FIG. 6A is a view illustrating source code in a form of c languageaccording to an embodiment of the disclosure, FIG. 6B is a viewillustrating source code of FIG. 6A converted into an intermediatelanguage form according to an embodiment of the disclosure, and FIG. 6Cis a view illustrating an indirect call is converted into a direct callin a code of an intermediate language form according to an embodiment ofthe disclosure.

In other words, FIG. 6A illustrates a sample code in a c language form,and may be converted into an intermediate language form as illustratedin FIG. 6B in the compilation process according to the disclosure. And,the process of changing the indirect call according to the disclosure tothe direct call may be implemented in an intermediate language form asillustrated in FIG. 6B.

For example, the electronic apparatus may identify a structure includinga function pointer in the code of intermediate language form. In otherwords, referring to FIG. 6B, the electronic apparatus may identify thatthe corresponding structure includes the function pointer fn through thebelow

struct of_devid_(——)of_table_example = { .compatible = “arm.example”,.fn = example_dev_init; .data = NULL; };of 621 in the intermediate language code.

The electronic apparatus may identify the first variable initializedamong the variables of the function pointer in the identified structure.Referring to FIG. 6B, the electronic apparatus may identify that thevariable for the function pointer fn is initialized through the below

D.1001=_of_table_example->fn;

result=D.1001(dev_node); of 622 area of the intermediate language code.In other words, the electronic apparatus may identify that the variablefor the function pointer fn is initialized in the 622 area of the codeof intermediate language form, and thus identify that the indirect callfunction exists in the 622 area.

Also, the electronic apparatus may modify the source code by changing anindirect call using a variable other than a variable to be reassigned ora variable transferred to a modifiable parameter to a direct call. Ifthe variable in the 622 area illustrated in FIG. 6B is not reassigned ortransferred to the modifiable parameter, the electronic apparatus maymodify an indirect call as below

D.1001=_of_table_example->fn;

result=D.1001(dev_node);

of 622 of FIG. 6B to the direct call as

example_dev_init(dev_node);.

FIG. 7 is a flowchart for changing an indirect call included in sourcecode into a direct call according to an embodiment of the disclosure.

Referring to FIG. 7, the electronic apparatus 100 may acquire sourcecode written in a programming language (S710). The programming languageaccording to the disclosure may include both languages written in anobject oriented programming language and languages not written in anobject oriented programming language. In addition, as an embodiment,source code that does not include annotation may be acquired.

The electronic apparatus 100 may identify a structure including afunction pointer in the source code (S720). Function pointers are a typeof pointers supported by programming languages and refer to executablecode in memory instead of referring to data values.

In the structure including the function pointer, the electronicapparatus 100 may identify the initialized first variable amongvariables with respect to the function pointer included in the structure(S730). Also, the electronic apparatus 100 may identify a variable thatcan be modified among the identified first variables as the secondvariable (S740). The modifiable variable may include at least one amongvariables transferred to the variable reassigned to the other variableor the variable transferred to the modifiable parameter.

Also, the electronic apparatus 100 may identify the remaining variablesother than the identified second variable among the first variables asthe third variable, and modify the indirect call using the thirdvariable to a direct call to modify the source code (S750).

Terms used in the present disclosure are selected as generalterminologies currently widely used in consideration of theconfiguration and functions of the present disclosure, but can bedifferent depending on intention of those skilled in the art, aprecedent, appearance of new technologies, and the like. Further, inspecific cases, terms may be arbitrarily selected. In this case, themeaning of the terms will be described in the description of thecorresponding embodiments. Accordingly, the terms used in thedescription should not necessarily be construed as simple names of theterms, but be defined based on meanings of the terms and overallcontents of the present disclosure.

It should be understood that the embodiments of the disclosure includevarious modifications, equivalents, and/or alternatives. In relation toexplanation of the drawings, similar drawing reference numerals may beused for similar constituent elements.

The terms “have”, “may have”, “include”, and “may include” used in theembodiments of the disclosure indicate the presence of correspondingfeatures (for example, elements such as numerical values, functions,operations, or parts), and do not preclude the presence of additionalfeatures.

In the description, the term “A or B”, “at least one of A or/and B”, or“one or more of A or/and B” may include all possible combinations of theitems that are enumerated together. For example, the term “A or B” or“at least one of A or/and B” may designate (1) at least one A, (2) atleast one B, or (3) both at least one A and at least one B. Theexpression “1”, “2”, “first”, or “second” as used herein may modify avariety of elements, irrespective of order and/or importance thereof,and only to distinguish one element from another. Accordingly, withoutlimiting the corresponding elements.

When an element (e.g., a first element) is “operatively orcommunicatively coupled with/to” or “connected to” another element(e.g., a second element), an element may be directly coupled withanother element or may be coupled through the other element (e.g., athird element). On the other hand, when an element (e.g., a firstelement) is “directly coupled with/to” or “directly connected to”another element (e.g., a second element), an element may not be existedbetween the other element.

In the description, the term “configured to” may be changed to, forexample, “suitable for”, “having the capacity to”, “designed to”,“adapted to”, “made to”, or “capable of” under certain circumstances.The term “configured to (set to)” does not necessarily mean“specifically designed to” in a hardware level. Under certaincircumstances, the term “device configured to” may refer to “devicecapable of” doing something together with another device or components.For example, “a sub-processor configured (or configured to) perform A,B, and C” may refer to a generic-purpose processor (e.g., centralprocessing unit (CPU) or an application processor) capable of performingcorresponding operations by executing a dedicated processor (e.g., anembedded processor) or one or more software programs stored in a memorydevice to perform the operations.

The term “module” as used herein includes units made up of hardware,software, or firmware, and may be used interchangeably with terms suchas logic, logic blocks, components, or circuits. A “module” may be anintegrally constructed component or a minimum unit or part thereof thatperforms one or more functions. For example, the module may be composedof application-specific integrated circuit (ASIC).

According to an embodiment, the various embodiments described above maybe implemented as software including instructions stored in amachine-readable storage media which is readable by a machine (e.g., acomputer). The device may include the electronic device according to thedisclosed embodiments, as a device which calls the stored instructionsfrom the storage media and which is operable according to the calledinstructions. When the instructions are executed by a processor, theprocessor may directory perform functions corresponding to theinstructions using other components or the functions may be performedunder a control of the processor. The instructions may include codegenerated or executed by a compiler or an interpreter. Themachine-readable storage media may be provided in a form of anon-transitory storage media. The ‘non-transitory’ means that thestorage media does not include a signal and is tangible, but does notdistinguish whether data is stored semi-permanently or temporarily inthe storage media.

In addition, according to an embodiment, the methods according tovarious embodiments described above may be provided as a part of acomputer program product. The computer program product may be tradedbetween a seller and a buyer. The computer program product may bedistributed in a form of the machine-readable storage media (e.g.,compact disc read only memory (CD-ROM) or distributed online through anapplication store (e.g., PlayStore™). In a case of the onlinedistribution, at least a portion of the computer program product may beat least temporarily stored or provisionally generated on the storagemedia such as a manufacturer's server, the application store's server,or a memory in a relay server.

Further, each of the components (e.g., modules or programs) according tothe various embodiments described above may be composed of a singleentity or a plurality of entities, and some subcomponents of theabove-mentioned subcomponents may be omitted or the other subcomponentsmay be further included to the various embodiments. Generally, oradditionally, some components (e.g., modules or programs) may beintegrated into a single entity to perform the same or similar functionsperformed by each respective component prior to integration. Operationsperformed by a module, a program, or other component, according tovarious embodiments, may be sequential, parallel, or both, executediteratively or heuristically, or at least some operations may beperformed in a different order, omitted, or other operations may beadded.

What is claimed is:
 1. A control method of an electronic apparatus, themethod comprising: acquiring a source code written in a programinglanguage; identifying a structure including a function pointer from theacquired source code; identifying a plurality of initialized variablesincluding a portion where the function pointer is initialized amongvariables of the function pointer included in the identified structure;and modifying the source code by changing an indirect call which uses anunmodifiable variable among the identified plurality of variables to adirect call.
 2. The control method of claim 1, wherein the plurality ofinitialized variables are a plurality of first variables, and themodifying further comprises identifying a modifiable second variableamong the plurality of first variables, and where the modifying of thesource code by the changing of the indirect call which uses a thirdvariable other than the modifiable second variable among the pluralityof first variables to the direct call, wherein the modifiable secondvariable is configured to comprise at least one of a variable to bereassigned or a variable transferred to a modifiable parameter.
 3. Thecontrol method of claim 2, wherein the third variable is a const typewhich is not modified.
 4. The control method of claim 1, wherein thecontrol method is configured to further comprise changing the modifiedsource code to a machine language.
 5. The control method of claim 1,wherein the source code does not include annotation.
 6. The controlmethod of claim 1, wherein the source code is written in a languageother than an object oriented programming language.
 7. The controlmethod of claim 1, wherein the control method is configured to beimplemented in a form of a plug-in in a compiler for a compilationoperation.
 8. The control method of claim 1, wherein the control methodis configured to be implemented in a form of a plug-in in a linker forcompilation.
 9. An electronic apparatus comprising: a memory configuredto store at least one instruction; and a processor configured to acquiresource code written in a programming language by executing theinstruction, identify a structure including a function pointer from theacquired source code, identify a plurality of initialized variablesincluding a portion where the function pointer is initialized amongvariables of the function pointer included in the identified structure,and modify the source code by changing an indirect call which uses anunmodifiable variable among the identified plurality of variables to adirect call.
 10. The electronic apparatus of claim 9, wherein theplurality of initialized variables are a plurality of first variables,and the processor is configured to identify a modifiable second variableamong the plurality of first variables, and where the modify of thesource code by the changing of the indirect call which uses a thirdvariable other than the modifiable second variable among the pluralityof first variables to the direct call, wherein the modifiable secondvariable is configured to comprise at least one of a variable to bereassigned or a variable transferred to a modifiable parameter.
 11. Theelectronic apparatus of claim 10, wherein the third variable is a consttype which is not modified.
 12. The electronic apparatus of claim 9,wherein the processor is configured to change the modified source codeto a machine language.
 13. The electronic apparatus of claim 9, whereinthe source code does not include annotation.
 14. The electronicapparatus of claim 9, wherein the source code is written in a languageother than an object oriented programming language.
 15. The electronicapparatus of claim 9, wherein the processor is configured to modify thesource code in a form of a plug-in in a compiler for compilation. 16.The electronic apparatus of claim 9, wherein the processor is configuredto modify the source code in a form of the plug-in in a linker forcompilation.